const path = require('path');
require('dotenv').config();
const axios = require('axios');
const { readFileSync } = require('fs')
// 指定文件路径
const filePath = 'public/vesion.json';

try {
  // 同步读取文件内容
  const data = readFileSync(filePath, 'utf8');
  const config = JSON.parse(data);
  const param = {
    'sysFlag': 'qsb',
    'version': config.version
  };
// 异步函数，用于发送版本号到后台
  const sendVersionToBackend = async (param,url) => {
    try {
      console.log('Request URL:', url + '/frontEndData/getVersion')
      const response = await axios.post(url + '/frontEndData/getVersion', param)
      console.log('Version sent successfully:', response.data)
    } catch (error) {
      console.error('Error sending version:', error)
    }
  };
  sendVersionToBackend(param,config.url)
} catch (err) {
  console.error(err);
}



